<?php
  session_start();
  require_once('includes/db.php');

  if(isset($_POST['email']))
  {
    $_POST = array_map('trim',$_POST);
    /*Check Captcha Code*/
    if($_POST['secretword'] == $_SESSION['secretword']) {

      unset($_POST['secretword']);
      unset($_POST['c_password']);

      $_POST['added_date'] = date('Y-m-d H:i:s');
      $_POST['status'] = '0';
      $_POST['password'] = md5($_POST['password']);

      $id = insert('users',$_POST);

      $flag = sendActivationMail($_POST['email'],$id);
      var_dump($flag);
      echo "<h4>records inserted on id</h4>
      <h1>$id</h1>";
    } else {
      echo "Invalid Security Code";
    }
  } else {
    header("location:register.html");
    exit;
  }
